<?php
class Test_facebook extends MX_Controller {

    public $firephp;
    function __construct()
	{
		parent::__construct();
                require_once(APPPATH.'libraries/FirePHPCore/FirePHP.class.php');
                //ob_start();
                $this->firephp = FirePHP::getInstance(true);
		$this->load->model('Facebook_model','fb');
	}
	
	function index()
	{
		$fb_data = $this->session->userdata('fb_data');

		$data = array(
				'fb_data' => $fb_data,
                             );
		
		$this->load->view('welcome', $data);
	}
	
	function topsecret()
	{
		$fb_data = $this->session->userdata('fb_data');
		
		if((!$fb_data['uid']) or (!$fb_data['me']))
		{
			redirect('test_facebook');
		}
		else
		{
			$data = array(
						'fb_data' => $fb_data,
						);
			
			$this->load->view('topsecret', $data);
		}
	}
        
        function friends_list()
        {
            $fb_data = $this->session->userdata('fb_data');
		
		if((!$fb_data['uid']) or (!$fb_data['me']))
		{
			redirect('test_facebook');
		}
            $data['friendslist']=$this->fb->get_friend();
            $this->firephp->log($data);
            $this->parser->parse('friends_list', $data,TRUE);
        }
        
        function status()
        {
            $fb_data = $this->session->userdata('fb_data');
		
		if((!$fb_data['uid']) or (!$fb_data['me']))
		{
			redirect('test_facebook');
		}
             $this->firephp->log($this->fb->get_status());
 
        }
        
         function get_user_info()
        {
            $fb_data = $this->session->userdata('fb_data');
		
		if((!$fb_data['uid']) or (!$fb_data['me']))
		{
			redirect('test_facebook');
		}
            $this->firephp->log($this->fb->get_user_info());
 
        }
        
}
?>